<template>
  <div class="feedback">
    <!-- head -->
    <qy-navigations
    btnType="normal"
    :tabFunList='tabFunList'
    @onSubmit='onSubmit'
    ></qy-navigations>
    <!-- content -->
    <div class="qy-box-space">
      <el-form ref="form" :model="form" label-width="80px">
        <el-form-item label="标题">
          <el-input v-model="form.title" placeholder="请填写标题" ></el-input>
        </el-form-item>
        <el-form-item label="内容" >
          <el-input type="textarea"  v-model="form.content" placeholder="请填写反馈内容..." ></el-input>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script>
import Request from '@/server/http'
import Api from '@/server/api'
import { ElMessage } from 'element-plus'
export default {
  name: "feedback",
  data() {
    return {
      //按钮列表
      tabFunList:[
        {name:'提交',type:'func',func:'onSubmit',path:''}
      ],
      form: {
          title: '',
          content: ''
        }
    };
  },
  methods: {
    onSubmit() {
      const params = this.form
      Request.requestPost(params, Api.feedback.add)
        .then((res) => {
          console.log(res);
          ElMessage({
            message: "success",
            center: true,
          });
          this.form.title = ''
          this.form.content = ''
        })
        .catch((err) => {
          console.log(err);
        });
    },
    Controller(name, type) {
      switch (name) {
        case "home":
          this.$router.push("/");
          break;
        default:
          break;
      }
    },
  },
};
</script>

<style scoped lang="scss">
</style>
